home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-06-23 | 1.3 KB | 51 lines |
- /*
- * QuickTime for Java SDK Sample Code
-
- Usage subject to restrictions in SDK License Agreement
- * Copyright: © 1996-1999 Apple Computer, Inc.
-
- */
- import quicktime.app.image.*;
- import quicktime.app.time.*;
- import quicktime.std.clocks.*;
- import java.awt.*;
- import quicktime.*;
-
- class TimeableID extends QTImageDrawer implements Ticklish {
- TimeableID (ScrollingText p, Dimension size) throws QTException {
- super (p, size, kMultiFrame);
- st = p;
- setRedrawing(true);
- }
-
- ScrollingText st;
- Timer t;
-
- public void setTimer (Timer t) throws QTException {
- this.t = t;
- }
-
- public boolean tickle (float er, int time) throws QTException {
- return doTickle ();
- }
-
- public void timeChanged (int time) throws QTException {
- doTickle();
- }
-
- // Has an offset of 18 at the bottom and 22 at the top == 40
- private boolean doTickle () throws QTException {
- st.oldy = st.y;
- TimeBase tb = t.getTimeBase();
- TimeBase master = tb.getMasterTimeBase();
- if (master != null) {
- int timeSpan = master.getStopTime(Ticklish.kScale) - master.getStartTime(Ticklish.kScale);
- st.y = (int)((master.getTime(Ticklish.kScale) / (float)timeSpan) * (st.height - 40) + 22);
- } else
- st.y = (tb.getTime((st.height - 40))) % (st.height - 40) + 22;
-
- redraw(null);
- return true;
- }
- }
-